<template>
    <div class="app-container">
        <header>
            <div>
                <el-form :model="form" inline size="small" label-width="130px">
                    <el-form-item label="姓名" label-width="100px">
                        <el-input v-model="form.name" placeholder="请输入姓名"></el-input>
                    </el-form-item>
                    <el-form-item label="是否受理">
                        <el-select v-model="form.name" clearable placeholder="请选择是否受理">
                            <el-option label="item.label" value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="教练">
                        <el-select v-model="form.name" filterable placeholder="请选择教练">
                            <el-option v-for="item in 10" :key="item" label="数字" value="数字">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="挂靠点">
                        <el-select v-model="form.name" filterable placeholder="请选择挂靠点">
                            <el-option v-for="item in 10" :key="item" label="数字" value="数字">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="开始受理日期">
                        <el-date-picker v-model="form.name" type="date"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="截止受理日期" label-width="100px">
                        <el-date-picker v-model="form.name" type="date"></el-date-picker>
                    </el-form-item>
                    <el-form-item label="备注">
                        <el-input v-model="form.name" placeholder="留言备注"></el-input>
                    </el-form-item>
                    <el-form-item label=" ">
                        <el-button type="primary" icon="el-icon-search">查询</el-button>
                        <el-button type="info" plain>导出</el-button>
                    </el-form-item>
                </el-form>
            </div>
        </header>

        <main>
            <div>
                <el-table :data="tableData" border max-height="650px" stripe
                    :default-sort="{ prop: 'date', order: 'descending' }">
                    <el-table-column prop="id" label="ID" sortable width="180" align="center" />
                    <el-table-column prop="tid" label="TID" sortable width="180" align="center">
                        <template slot-scope="scope">
                            <span style="color: #4d4de2;cursor: pointer;"
                                @click="go(scope.row, 'http://jx.qida999.com/DriverCommon/driver/DrTextSl.html')">{{
                                    scope.row.tid }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="vdate" label="日期" sortable width="180" align="center" />
                    <el-table-column prop="typeExt" label="类型" sortable width="180" align="center" />
                    <el-table-column prop="pid" label="PID" sortable width="180" align="center">
                        <template slot-scope="scope">
                            <span style="color: #4d4de2;cursor: pointer;"
                                @click="go2(scope.row, 'http://jx.qida999.com/DriverCommon/driver/dr_person.html')">{{
                                    scope.row.pid }}</span>
                        </template>
                    </el-table-column>
                    <el-table-column prop="name" label="学员" width="180" align="center" />
                    <el-table-column prop="idcard" label="身份证" width="180" align="center" />
                    <el-table-column prop="car" label="车型" width="180" align="center" />
                    <el-table-column prop="leader" label="教练" width="180" align="center" />
                    <el-table-column prop="com_name" label="挂靠点" width="180" align="center" />
                    <el-table-column prop="isReg" label="受理" width="180" align="center" />
                    <el-table-column prop="ep" label="备注" width="180" align="center" />
                </el-table>
            </div>
        </main>

        <!-- 分页 -->
        <div class="pagin">
            <el-pagination background :current-page="initParams.page" :page-sizes="[20, 50, 100, 150]"
                :page-size="initParams.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total"
                @size-change="handleSizeChange" @current-change="handleCurrentChange" />
        </div>
    </div>
</template>

<script>
import { accepDetailAPI } from '@/api/adminstare'

/**
* @author        Yng
* @time          2023-11-14 15:14:36  星期二
* @description   考试受理明细
**/


export default {
    name: 'accepDetail',
    data() {
        return {
            form: {
                name: '',
            },
            tableData: [],
            total: 0,
            // 初始化参数
            initParams: {
                action: 'slDetailList',
                sortStr: 'id desc',
                type: '0',
                stime: '',
                svdate: '',
                evdate: '',
                id: '',
                name: '',
                ep: '',
                page: 1,
                pageSize: 20
            }
        }
    },
    mounted() {
        this.getAccpe()
    },
    methods: {
        async getAccpe() {
            let { code, data, total } = await accepDetailAPI(this.initParams)
            if (!code) {
                this.tableData = data
                this.total = total
            }
        },
        //  跳旧版详情
        go(val, URL) {
            const redirectUrl = `${URL}?&aid=${this.$store.getters.userInfo.jxid}&id=${val.tid}&type=0`
            this.$oldLoginSystem(redirectUrl)
        },
        go2(val, URL) {
            const redirectUrl = `${URL}?&aid=${this.$store.getters.userInfo.jxid}&id=${val.pid}&type=0`
            this.$oldLoginSystem(redirectUrl)
        },

        // 当前显示的条数 发生改变时触发
        handleSizeChange(pageSize) {
            this.initParams.pageSize = pageSize || 20
            this.getAccpe()
        },
        // 当前页码发生改变时触发
        handleCurrentChange(page) {
            this.initParams.page = page || 1
            this.getAccpe()
        },
    }
}
</script>

<style lang="scss" scoped></style>